#ifndef WORKER_THREAD_H
#define WORKER_THREAD_H

#include <QThread>
#include <QWidget>
#include <cstdint>
#include <cfloat>
#include <QColor>

class WorkerThread : public QThread
{
Q_OBJECT
public:
    explicit WorkerThread();
    ~WorkerThread() override;
    void Flush();

private:
    uint8_t* screenBuffer = nullptr;
    float* zBuffer = nullptr;
    inline const static float floatMax = FLT_MAX;
    size_t pixelTotal = 0;

    void ClearZBuffer();
    void ClearScreenBuffer(const QColor& c = QColor(0, 0, 0));

    void run() override;

signals:
    void Show(const uint8_t*);

private:
    bool ShouldStop = false;

private slots:
    void Stop();
};


#endif //WORKER_THREAD_H
